Support IP address validation in certificate SAN#2873
Merged
Conversation
Fix SSL certificate validation to check for IP address entries (type 7) in Subject Alternative Name extension, in addition to DNS names (type 2). This allows connections via IP address when the certificate's SAN contains that IP, without requiring the hostNameInCertificate workaround.
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #2873 +/- ##
============================================
+ Coverage 56.44% 59.10% +2.66%
- Complexity 4559 4787 +228
============================================
Files 151 151
Lines 34560 34577 +17
Branches 5768 5776 +8
============================================
+ Hits 19508 20438 +930
+ Misses 12418 11407 -1011
- Partials 2634 2732 +98 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
machavan
approved these changes
Jan 6, 2026
muskan124947
approved these changes
Jan 6, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Merging community contribution from PR #2865 by @tangtheone (Pei-Tang Huang)
Objective:
Enable SSL/TLS certificate validation for connections using IP addresses directly, without requiring the
hostNameInCertificateworkaround. Currently, the JDBC driver only validates DNS hostnames in certificates' Subject Alternative Name (SAN) extension, causing connection failures when users connect via IP address even when the certificate contains that IP in its SAN.Solutions:
SQLServerCertificateUtils.validateServerNameInCertificate()to check for both:Key Changes:
SQLServerCertificateUtils.javato add IP address (type 7) checking alongside existing DNS name (type 2) validationSSLCertificateValidationTest.javaTesting:
Standards Compliance: RFC 5280 Section 4.2.1.6 (Subject Alternative Name)
Original contribution: #2865